package com.bcw.springtest.bean;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Profile;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Data
@ConfigurationProperties(prefix = "acme")
@Profile("dev")
public class AcmeProperties {

    public boolean enabled;
    private List<Address> address;
    private final Security security = new Security();

    @Data
    public static class Security {

        private String username;

        private String password;

        private List<String> roles = new ArrayList<>(Collections.singleton("USER"));

    }

    @Override
    public String toString() {
        return "enabled=" + enabled + ",Address=" + address +
                ",security.username=" + security.getUsername() + "security.password=" + security.getPassword()
                + "roles=" + security.getRoles().toString();
    }
}
